//
//  BGViewController.m
//  bingke
//
//  Created by zhangkt zhangkt on 12-10-14.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "BGViewController.h"
#import "BGActivityViewController.h"
#import "BGShoppingMallViewController.h"
#import "BGRoadLineViewController.h"


@implementation BGViewController

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"缤客 账主界面-02.png"]];
    imageView.frame = CGRectMake(0, 0, 320, 460);
    [self.view addSubview:imageView];
    [UIView animateWithDuration:1.5 animations:^() 
    {
        imageView.frame = CGRectMake(-60, -60, 440, 580);
        
    } completion:^(BOOL finished) 
    {
        [UIView animateWithDuration:1  delay:0 options:0 animations:^() 
        {
            imageView.frame = CGRectMake(0, 0, 320  ,460);
        } completion:^(BOOL finished) 
        {
            imageView.image = [UIImage imageNamed:@"缤客 账主界面-03.png"];
            NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"BGMenuView" owner:self options:nil];
            myView = [[BGMenuView alloc] init];
            myView = [array objectAtIndex:0];
            myView.frame = [BGMenuView getFrame];
            myView.backgroundColor = [UIColor clearColor];
            [self.view addSubview:myView];
            
            UIButton *activityButton = [UIButton buttonWithType:UIButtonTypeCustom];
            activityButton.frame = CGRectMake(64,38 , 65, 52);
            [activityButton addTarget:self action:@selector(activityButton) forControlEvents:UIControlEventTouchUpInside];
            activityButton.backgroundColor = [UIColor clearColor];
            [myView addSubview:activityButton];
            
            UIButton *roadButton = [UIButton buttonWithType:UIButtonTypeCustom];
            roadButton.frame = CGRectMake(0,44 , 65, 46);
            [roadButton addTarget:self action:@selector(roadButton) forControlEvents:UIControlEventTouchUpInside];
            roadButton.backgroundColor = [UIColor clearColor];
            [myView addSubview:roadButton];
            
            UIButton *shoppintButton = [UIButton buttonWithType:UIButtonTypeCustom];
            shoppintButton.frame = CGRectMake(128,38 , 65, 52);
            [shoppintButton addTarget:self action:@selector(shoppintButton) forControlEvents:UIControlEventTouchUpInside];
            shoppintButton.backgroundColor = [UIColor clearColor];
            [myView addSubview:shoppintButton];
            
            UIButton *assignmentButton = [UIButton buttonWithType:UIButtonTypeCustom];
            assignmentButton.frame = CGRectMake(191,38 , 65, 52);
            [assignmentButton addTarget:self action:@selector(assignmentButton) forControlEvents:UIControlEventTouchUpInside];
            assignmentButton.backgroundColor = [UIColor clearColor];
            [myView addSubview:assignmentButton];
            
            UIButton *countButton = [UIButton buttonWithType:UIButtonTypeCustom];
            countButton.frame = CGRectMake(254,44 , 66, 46);
            [countButton addTarget:self action:@selector(countButton) forControlEvents:UIControlEventTouchUpInside];
            countButton.backgroundColor = [UIColor clearColor];
            [myView addSubview:countButton];
        }];
    }];
}

- (void) activityButton
{
    BGActivityViewController *activityViewController = [[BGActivityViewController alloc] initWithNibName:@"BGActivityViewController" bundle:nil];
    BGAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
    [appDelegate.mainNavigationController pushViewController:activityViewController animated:NO];
    [activityViewController release];
}

- (void) roadButton
{
    BGRoadLineViewController *roadLineViewController = [[BGRoadLineViewController alloc] initWithNibName:@"BGRoadLineViewController" bundle:nil];
    BGAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
    [appDelegate.mainNavigationController pushViewController:roadLineViewController animated:NO];
    [roadLineViewController release];
}

- (void) shoppintButton
{
    BGShoppingMallViewController *shoppingMallViewController = [[BGShoppingMallViewController alloc] initWithNibName:@"BGShoppingMallViewController" bundle:nil];
    BGAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
    [appDelegate.mainNavigationController pushViewController:shoppingMallViewController animated:NO];
    [shoppingMallViewController release];
}

- (void) assignmentButton
{
    
}

- (void) countButton
{
    
}

- (void)viewDidUnload
{
    [super viewDidUnload];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

- (IBAction)huodong:(id)sender 
{
    NSLog(@"****************");
}

- (void)dealloc 
{
    [super dealloc];
}
@end
